#include<stdio.h>

int main()
{
    int a[10] = {2,4,6,8,1,5,9,0,3,7};
    int i = 1;
    int tmp = 0;
    int k = 0;
    for(i;i < 10;i++)
        {
            k = i;
       /*-- this is another method
            while(k > 0 && a[k] < a[k - 1])
                {
                 tmp = a[k];
                 a[k] = a[k-1];
                 a[k-1] = tmp;
                 k--;
                }
         */
            int key = a[i];
            while(k > 0 && key < a[k - 1])
                {
                    a[k] = a[k-1];
                    k--;
                }
            a[k] = key;
        }

    for(i = 0;i < 10;i++)
        printf("%d ",a[i]);
   return 0;
}
